<?php
/*********************/
/*                   */
/*  后台发货模块       */
/*   BY voiet        */
/*   2009-8-14更新    */
/*                   */
/*********************/

//require_once( CORE_DIR."/model/trading/mdl.shipping.php" );
class cmd_shipping extends mdl_shipping
{

	

	function searchoptions( )
	{
		return array( "logi_no" => "物流单号", "order_id" => "订单号", "ship_name" => "收货人姓名", "ship_mobile" => "收货人手机", "ship_tel" => "收货人电话", "member_id" => "用户ID", "delivery_id" => "发货序号","ship_area" => "发货地区" );
	}

	function getfilter( $p )
	{
		return $return;
	}

	function _filter( $filter )
	{
		$filter['type'] = "delivery";
		$where = array( 1 );
		if ( $filter['mint_begin'] && $filter['maxt_begin'] )
		{
			$where[] = " (t_begin>=".strtotime( $filter['mint_begin'] )." AND t_begin<=".strtotime( $filter['maxt_begin']." 23:59:59" ).") ";
		}
		else if ( $filter['mint_begin'] )
		{
			$where[] = "t_begin>=".strtotime( $filter['mint_begin'] );
		}
		else if ( $filter['maxt_begin'] )
		{
			$where[] = "t_begin<=".strtotime( $filter['maxt_begin']." 23:59:59" );
		}
		if ( $filter['minmoney'] && $filter['maxmoney'] )
		{
			if ( $filter['minmoney'] == $filter['maxmoney'] )
			{
				$where[] = "money=".$filter['minmoney'];
			}
			else if ( $filter['minmoney'] < $filter['maxmoney'] )
			{
				$where[] = " (money>=".$filter['minmoney']." AND money<=".$filter['maxmoney'].") ";
			}
		}
		else if ( $filter['minmoney'] )
		{
			$where[] = "money>=".$filter['minmoney'];
		}
		else if ( $filter['maxmoney'] )
		{
			$where[] = "money<=".$filter['maxmoney'];
		}
		if ( isset( $filter['ship_area'] ) )
		{
			$where[] = "ship_area LIKE '%".$filter['ship_area']."%'";
			unset( $filter['ship_area']);
		}
		return mdl_delivery::_filter( $filter )." AND ".implode( $where, " AND " );;
	}

	

}

?>